<template>
  <div class="tab-control">
    <div
      class="tab-item"
      v-for="(item, index) in tabTitles"
      :key="item"
      @click="tabItemClick(index)"
    >
      <span :class="{ active: currentIndex === index }">{{ item }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: "TabControl",
  components: {},
  props: {
    tabTitles: {
      type: Array,
      default: () => [],
    },
    isStick: {
      type: Boolean,
      default: false,
    },
    currentIndex: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      offsetTop: 0,
    };
  },
  methods: {
    tabItemClick(index) {
      this.$emit("changeTabPane", index);
    },
  },
};
</script>

<style scoped>
.tab-control {
  display: flex;
  width: 100%;
  height: 40px;
}
.tab-item {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
}
span {
  padding: 6px;
}
.active {
  color: #ff8198;
  border-bottom: solid 2.5px #ff8198;
}
</style>